home *** CD-ROM | disk | FTP | other *** search
/ Zoom 2 / Zoom - Release 2 (1996)(Active Software)[!].iso / programming / amos / amossible / spritesnbobs / amalanim.amos / amalanim.amosSourceCode next >
Encoding:
AMOS Source Code  |  1980-05-17  |  3.1 KB  |  66 lines

  1. '****************ITS THE CACOPHONY CARTOON CLUB!-By Mark Wickson*********************
  2. Rem You may have written a wonderful game,but what happens when you want 
  3. Rem to make one of your sprites/bobs become animated-But you don't actually
  4. Rem want to do it by adding to,or taking away from a variable.So thats 
  5. Rem where Amal comes in-Its a special sub-language that only users of  
  6. Rem the original AMOS and "AMOS Pro" can use.
  7. Rem When making your Bob/Sprite banks you should consider if you want
  8. Rem anything to be animated-If so design your bank accordingly.
  9. Rem Here we load in the JUMP.Abk file which contains three images,those
  10. Rem of a little man jumping in the air-You could have many more frames,but 
  11. Rem this is just a simple example. 
  12. Rem First we place Bob one rougly in the centre of the screen with 
  13. Rem "Bob 1,150,110,1"
  14. Rem Then,in order for AMOS to know that Bob 1 is to be animated,we have
  15. Rem to assign an AMAL channel to it,this is simply done by typing
  16. Rem Channel  
  17. Rem and then we have todecide which channel we want to use,since we
  18. Rem haven't used any others yet,we can start with channel 1
  19. Rem Channel 1 To Bob 
  20. Rem (The above "Bob" can be changed to "Sprite" if you're using sprites) 
  21. Rem Now we decide which Bob/Sprite we want to animate-We want it 
  22. Rem to be bob 1,so we'd write: 
  23. Rem Channel 1 To Bob 1 
  24. Rem You can have as many moving or animating Bobs/Sprites as you want.   
  25. Rem Since we have declared that channel 1 is to be allocated to Bob 1,we must  
  26. Rem now say what animation the Bob will undergo(This could be movement-But 
  27. Rem here we just flip through some of its images)-So type: 
  28. Rem Amal 
  29. Rem and then the number of the channel you are going to define,in this case
  30. Rem its "1": 
  31. Rem Amal 1,""
  32. Rem Since we want to animate the Bob we put the Anim command inside
  33. Rem the brackets,and then the number of times we want the animation to 
  34. Rem play-zero is `forever'.
  35. Rem Amal 1,"Anim 0, "
  36. Rem Next,you must put the first image number of your animation,then a comma, 
  37. Rem then the time you want the image to screen for before showing the next one 
  38. Rem -This time is measured in 50ths of a second,here we start with image 
  39. Rem one and pause for point seven of a second. 
  40. Rem Amal 1,"Anim 0,(1,7) " 
  41. Rem then you do the same thing for the next frame,like this: 
  42. Rem Amal 1,"Anim 0,(1,7)(2,7)" 
  43. Rem And so on,adding as many frames as you want. 
  44. Rem Notice we don't put commas between the brackets. 
  45. Rem We then have to turn the amal channels on,this can be done either  
  46. Rem by using the "Amal On" command,which turns on all Amal channels, 
  47. Rem or by typing "Amal On and then the number of the channel we want to
  48. Rem turn on,in this case channel 1.  
  49. Rem we then have to set up a "Do....Loop"-If we didn't(Because the 
  50. Rem program is so short)the program would end before we even saw the Bob.
  51. Rem You won't usaually need to do this in a program,unless its VERY  
  52. Rem short. 
  53. Rem NOTE:You must have put the Bob/sprite on screen or AMOS will turn the
  54. Rem Amal channel on ,but you won't see anything. 
  55. Screen Open 0,320,256,16,Lowres
  56. Load "ATTBG:JUMP.Abk"
  57. Get Sprite Palette 
  58. Flash Off 
  59. Curs Off 
  60. Cls 0
  61. Bob 1,150,110,1
  62. Channel 1 To Bob 1
  63. Amal 1,"Anim 0,(1,7)(2,7)(3,7)"
  64. Amal On 1
  65. Do 
  66. Loop